The invention relates to a method for encoding of a bit amount of a data section and to a corresponding decoding method. Furthermore, the invention relates to encoding, decoding, transmission and/or storage of audio and/or video data wherein said method for encoding of a bit amount of a data section and/or said corresponding decoding method are used in processing of the audio and/or video data.
Different variable length coding schemes for lossless encoding of integers had been proposed. For instance, Elias, P., describes in: “Universal Codeword Sets and Representations of the Integers”; IEEE Trans. on Inf. Theo., IT-21:2, March 1975; pp 194-203 so-called Gamma code for integers larger than 1. Gamma code consists of variable length binary code of the encoded integer from most significant bit (MSB) to least significant bit (LSB) preceded by a unary code of the length of the binary code diminished by 1.
Other variable length coding schemes are described by Golomb, S. W., in: “Run-length Coding”, IEEE Trans. on Inf. Theo., IT-12:4, July 1966; pp 399-401, and by Rice, R. F., in: “Same Practical Universal Noiseless Coding Techniques”; Jet Propulsion Laboratory; JPL Publication 79-22; Pasadena Cal.; March 1979, are well suited for to-be-coded values having probabilities of occurrence which follow Geometric/Laplace like distribution functions.
Golomb coding is parameterized by a Golomb factor. This allows for adjusting Golomb coding to the concrete distribution function of the data to-be-encoded.
Golomb code consists of a prefix of unary code, i.e. a corresponding number of equally valued bits, representing a quotient separated by a separator bit, i.e. a bit of different value than said equally valued bits, from a suffix of binary code of fixed length representing a remainder. Said fixed length corresponds to the bit amount required for binary encoding the Golomb factor. That is, the fixed number equals the integer part of the logarithm of the Golomb factor to the base of 2, said integer part being increased by 1. The integer encoded can be retrieved by retrieving the quotient through reading and counting equally valued bits until the separator bit is read and then reading and decoding the remainder from the following fixed number of bits. Then, the quotient is multiplied with the Golomb factor before it is added the reminder.
For encoding, the quotient is determined as the integer part of the value to-be-encoded divided by the Golomb factor and the remainder is determined as the difference between the value to-be-encoded and the determined quotient times the Golomb factor.
Rice coding is a special case of Golomb coding where the Golomb factor equals 2 raised to the power of a so-called Rice coefficient and the size of the part carrying binary code equals said Rice coefficient.
By construction, the shortest Golomb codes comprise at least said fixed number of bits and the separator bit.
Thus, the larger the Golomb factor the larger is the fixed number and the larger is the code for the small integers. But as well, the shorter is the code for large integers. Disadvantageously, although most of the values to-be-encoded in audio data and/or video data follow a Geometric/Laplace like distribution function, there are some large values to-be-encoded which are rare but more likely to occur than predicted by a distribution function fitted to frequently occurring smaller values.
So, when adjusting the Golomb factor to a distribution function fitted to the frequently occurring smaller values, only, the Golomb factor is chosen that small that said large values require an enormous unary part and thus result in a data rate explosion.
And, when adjusting the Golomb factor to a distribution function fitted to all values, the Golomb factor is chosen that large that said frequently occurring smaller values are coded with more bits then necessary which also results in a data rate explosion.
There is a need for efficient encoding of values following such hybrid distributions.